home *** CD-ROM | disk | FTP | other *** search
- PROGRAM midi;
- {+-------------------------------------------------------------------+
- | |
- | *** MINI MIDI ST *** |
- | a computerized sequencer by Tim Trzepacz |
- | |
- +-------------------------------------------------------------------+}
-
- CONST
- {$I gemconst.pas}
- TYPE
- {$I gemtype.pas}
- Pointers = RECORD
- a,b,c,d,e,f,g,h,i : Integer;
- END;
-
- Midi_Data = RECORD
- time : long_integer;
- cmd : Integer;
- END;
- Midi_Ary = ARRAY [1..5000] OF Midi_Data ;
- VAR D : Midi_Ary;
- Ed : Integer;
- Data : text;
-
- {$I gemsubs.pas}
-
- FUNCTION bconin( device : Integer ) : Long_Integer ;
- BIOS( 2 ) ;
-
- FUNCTION bconstat( device : Integer ) : Boolean ;
- BIOS( 1 );
-
- PROCEDURE bconout(device,c: Integer);
- BIOS( 3 );
-
- FUNCTION Make_Window( title : Window_Title; Var x,y,w,h : Integer;
- style,color, t : Integer) : Integer;
- BEGIN
- handle:= New_Window( t , title , 0,0,0,0 );
- Open_Window( handle, x , y , w , h );
- Work_Rect( handle, x , y , w , h );
- Set_Clip( x , y , w , h );
- Paint_Style( style );
- Paint_Color( color );
- Paint_Rect( x , y , w , h );
- Make_Window:=handle;
- END;
-
- FUNCTION Setup_Menu(VAR P:Pointers) : Dialog_Ptr;
- VAR PT : Dialog_Ptr;
- BEGIN
- PT:=New_Dialog(10,0,0,40,11);
- P.a:= Add_DItem( PT , G_Box , None,1,1,38,4,-4 ,Black*4096|0*256|112|Red);
- P.b:= Add_DItem( PT , G_Text, None,15,2,9,1,0,Black);
- Set_DText( PT , P.b,'MINI MIDI',System_Font,TE_Center);
- P.d:= Add_DItem( PT , G_Text, None,18,3,3,1,0,Black);
- Set_DText( PT , P.d,'S T',System_Font,TE_Center);
- P.f:= Add_DItem( PT , G_Text, None,2,7,13,1,0,Black * 256|Black);
- Set_DText( PT , P.f,'Select Option',System_Font,TE_Center);
- P.h:= Add_DItem( PT , G_Button,5,2,9,6,1,1,1);
- Set_DText( PT , P.h,' EXIT ',System_Font,TE_Center);
- P.i:= Add_DItem( PT , G_Button,5,9,9,6,1,1,1);
- Set_DText( PT , P.i,' LOAD ',System_Font,TE_Center);
- P.e:= Add_DItem( PT , G_Button,5,16,9,6,1,1,1);
- Set_DText( PT , P.e,' SAVE ',System_Font,TE_Center);
- P.g:= Add_DItem( PT , G_Button,5,23,9,6,1,1,1);
- Set_DText( PT , P.g,' PLAY ',System_Font,TE_Center);
- P.c:= Add_DItem( PT , G_Button,5,30,9,8,1,1,1);
- Set_DText( PT , P.c,' RECORD ',System_Font,TE_Center);
- Center_Dialog( PT );
- Setup_menu:=PT;
- END;
-
- PROCEDURE Load_File;
- VAR I : Integer;
- fil : Path_Name;
- pat : Path_Name;
- dinfo : STR255;
- lode : Boolean;
-
- BEGIN
- dinfo:='[1][Warning: Using this option will | erase the file currently';
- dinfo:=Concat(dinfo,'| in memory.][ CANCEL | LOAD ]');
- I:=Do_Alert(dinfo,1);
- IF I=2 THEN
- BEGIN
- pat:='A:\*.MDI';
- lode:=Get_In_File( pat,fil);
- IF lode THEN
- BEGIN
- Text_Color(Red);
- Text_Style(Thickened|Slanted|Outlined);
- Draw_Mode(2);
- Hide_Mouse;
- Draw_String(285,90,'~~ Loading ~~');
- Text_Color(Black);
- Text_Style(0);
- Show_Mouse;
- Reset(Data,fil);
- Readln(data,Ed);
- FOR I:=1 To Ed DO
- BEGIN
- Readln(data,D[I].time);
- Readln(data,D[I].cmd);
- END;
- Close(Data);
- Paint_Color(Green);
- Paint_Style(1);
- Hide_Mouse;
- Paint_Rect(20,20,600,150);
- Show_Mouse
- END
- END
- END;
-
- PROCEDURE Save_File;
- VAR I : Integer;
- fil : Path_Name;
- pat : Path_Name;
- dinfo : STR255;
- sav : Boolean;
-
- BEGIN
- pat:='A:\*.MDI';
- sav:=Get_In_File( pat,fil);
- IF sav THEN
- BEGIN
- Text_Color(Red);
- Text_Style(Thickened|Slanted|Outlined);
- Draw_Mode(2);
- Hide_Mouse;
- Draw_String(285,90,'~~ Saving ~~');
- Text_Color(Black);
- Text_Style(0);
- Show_Mouse;
- Rewrite(Data,fil);
- Writeln(data,Ed);
- FOR I:=1 To Ed DO
- BEGIN
- Writeln(data,D[I].time);
- Writeln(data,D[I].cmd);
- END;
- Close(Data);
- Paint_Color(Green);
- Paint_Style(1);
- Hide_Mouse;
- Paint_Rect(20,20,600,150);
- Show_Mouse
- END
- END;
-
- PROCEDURE Clear_Midi_Buffer;
- Var Dummy:Long_Integer;
- BEGIN
- While Bconstat(3)=True DO
- BEGIN
- dummy:=bconin(3);
- END;
- END;
-
- PROCEDURE Play_Music ;
- VAR I , du : Integer;
- dinfo : STR255;
- At : Long_Integer;
- Test : boolean;
- dummy : Long_Integer;
- BEGIN
- dinfo:='[0][Play Recording:| Press the RETURN key';
- dinfo:=Concat(dinfo,'| to play the recording,');
- dinfo:=Concat(dinfo,'| or click on cancel to');
- dinfo:=Concat(dinfo,'| abort.][ Cancel | Play ]');
- I:=Do_Alert(dinfo,2);
- IF I=2 THEN
- BEGIN
- Text_Color(Red);
- Text_Style(Thickened|Slanted|Outlined);
- Draw_Mode(2);
- Hide_Mouse;
- Clear_Midi_Buffer;
- Draw_String(285,90,'Playing');
- Text_Color(Black);
- Text_Style(0);
- Draw_String(200,99,'Press any key to stop playing.');
- Show_Mouse;
- AT:=0;
- I:=1;
- REPEAT
- AT:=AT+1;
- For du:=1 to 5 DO
- BEGIN
- ;
- END;
- IF D[I].time=AT THEN
- BEGIN
- bconout(3,D[I].cmd);
- I:=I+1;
- END;
- Test:=bconstat(2);
- UNTIL Test or (I=Ed);
- If Test THEN dummy:=bconin(2);
- Draw_Mode(1);
- Paint_Color(Green);
- Paint_Style(1);
- Hide_Mouse;
- Paint_Rect(20,20,600,150);
- Show_Mouse
- END
- END;
-
- FUNCTION Record_Music : Integer;
- VAR I : Integer;
- dinfo : STR255;
- At : Long_Integer;
- dummy : Long_Integer;
- BEGIN
- dinfo:='[0][Record Music:| Press the RETURN key';
- dinfo:=Concat(dinfo,'| to start recording, or');
- dinfo:=Concat(dinfo,'| click on cancel to abort.]');
- dinfo:=Concat(dinfo,'[ Cancel | Record ]');
- I:=Do_Alert(dinfo,2);
- IF I=2 THEN
- BEGIN
- Text_Color(Black);
- Text_Style(Thickened|Slanted|Outlined);
- Draw_Mode(2);
- Hide_Mouse;
- Clear_Midi_Buffer;
- Draw_String(275,90,'Recording');
- Text_Style(0);
- Draw_String(192,99,'Press any key to stop recording.');
- Show_Mouse;
- AT:=0;
- I:=1;
- REPEAT
- AT:=AT+1;
- IF bconstat(3) THEN
- BEGIN
- dummy:=bconin(3);
- D[I].time:=AT;
- D[I].cmd :=int(dummy);
- I:=I+1
- END;
- UNTIL bconstat(2);
- Record_Music:=I;
- dummy:=bconin(2);
- Draw_Mode(1);
- Paint_Color(Green);
- Paint_Style(1);
- Hide_Mouse;
- Paint_Rect(20,20,600,150);
- Show_Mouse
- END
- END;
-
- PROCEDURE Bye ;
- VAR dinfo : STR255;
- dummy : integer;
- BEGIN
- dinfo:='[0][ Mini Midi ST';
- dinfo:=concat(dinfo,'| version 1.0');
- dinfo:=concat(dinfo,'|------------------');
- dinfo:=concat(dinfo,'| By Tim Trzepacz');
- dinfo:=concat(dinfo,'| and Darren Moon');
- dinfo:=concat(dinfo,'|------------------');
- dinfo:=Concat(dinfo,'|Wireless Computing');
- dinfo:=concat(dinfo,'| Services 8/19/86]');
- dinfo:=Concat(dinfo,'[ Bye ]');
- dummy:=Do_Alert(dinfo,1);
- END;
-
- PROCEDURE Menu;
- VAR PT : Dialog_Ptr;
- Op : Integer;
- P : Pointers;
- BEGIN
- REPEAT
- PT:=Setup_Menu(P);
- Op:= Do_Dialog( PT , 0);
- End_Dialog( PT );
- WITH P DO
- BEGIN
- IF Op=I THEN Load_File
- ELSE IF Op=E THEN Save_File
- ELSE IF Op=G THEN Play_Music
- ELSE IF OP=C THEN Ed:=Record_Music
- END;
- UNTIL (Op=P.h);
- END;
-
- BEGIN
- IF Init_GEM >=0 THEN
- BEGIN
- Init_Mouse;
- Ed:=2;
- Menu;
- Bye;
- Exit_Gem
- END
- END.
- əəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəə